# Maintainer: Kyle Keen <keenerd@gmail.com>

pkgname=airspy
pkgver=1.0.10
pkgrel=1
pkgdesc="Host code for Airspy SDR."
arch=('loong64' 'x86_64')
url="https://www.airspy.com"
license=('GPL2')
depends=('libusb>=1.0')
makedepends=('cmake')
source=("$pkgname-$pkgver.tar.gz::https://github.com/airspy/airspyone_host/archive/v$pkgver.tar.gz"
        "airspy.conf")
sha512sums=('61ea82e8b9892053b6fdccd7de05f248145bb5da0d4f63bb31d3a815fa739b248662a875d53d88de260cfa2a98ef266ea165ba50397e67822ea21ca273c93b24'
            '6dfc97dd628c39980861e01c89d8a32e72929f19e2d64c6aa37f41cbfb5832a7aefba9a79d631c0235080252668a1d04e2e723b2a68e10df88cc8bcf964cfca8')

prepare() {
  cd "$srcdir/airspyone_host-$pkgver"
  # FS#47169
  sed -i 's|MODE.*$|TAG+="uaccess"|' airspy-tools/52-airspy.rules
}

build() {
  cd "$srcdir/airspyone_host-$pkgver"
  mkdir -p build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -Wno-dev ../
  make
}

package() {
  cd "$srcdir/airspyone_host-$pkgver/build"
  make DESTDIR="$pkgdir" install
  install -Dm644 "../airspy-tools/52-airspy.rules" "$pkgdir/usr/lib/udev/rules.d/52-airspy.rules"
  install -Dm644 "$srcdir/airspy.conf" "$pkgdir/etc/modprobe.d/airspy.conf"
}

# vim:set ts=2 sw=2 et:
